// 拼接HTTPUrl
function url(type, pathname) {
  return window.RPConfig[type] + pathname
}

const questionnaireApi = {
  getAnsByUserId: params => {
    return $http.get(url('itShare', `/itsQuestionAns/getAnsByUserId?userId=${params.userCode}`), {})
  },
  insert: params => {
    return $http.post(url('itShare', `/itsQuestionAns/insert`), params)
  },
  findList: params => {
    return $http.post(url('itShare', `/itsQuestionAns/findList`), params)
  },
  getById: params => {
    return $http.get(url('itShare', `/itsQuestionAns/getById?id=${params.id}`), {})
  },
  update: params => {
    return $http.post(url('itShare', `/itsQuestionAns/update`), params)
  },
  queryAutoRefreshSubmitStatus: params => {
    return $http.post(url('itShare', `/systemConfig/autoRefresh/submit/result?id=${params.id}`), {})
  },
  permissionSubmit: params => {
    return $http.post(url('itShare', `/systemConfig/permission/submit`), params)
  },
  queryPermissionSubmitStatus: params => {
    return $http.post(url('itShare', `/systemConfig/permission/submit/result?id=${params.id}`), {})
  },
  countSubmit: params => {
    return $http.post(url('itShare', `/rptPlantaskStypeData/calculatePlanTaskData`), params)
  },
  // 获取统计周期list
  getCycleList: params => {
    return $http.get(url('itShare', `/rptPlantaskDataStat/getStatCycleList`), params)
  },
  // 获取登录人业务单元list
  getBusinessUnitList: params => {
    return $http.get(url('itShare', `/rptPlantaskDataStat/getTrgNodeList`), params)
  },
  // 查看任务表统计信息
  getTaskStatisticData: params => {
    return $http.post(url('itShare', `/rptPlantaskDataStat/queryTaskStatisticData`), params)
  },
  // 查看任务表统计信息
  getMeasureAndAreaStaticData: params => {
    return $http.post(url('itShare', `/rptPlantaskDataStat/queryMeasureAndAreaStaticData`), params)
  },
  // 汇总所有业务单元数据
  getSummaryData: params => {
    return $http.post(url('itShare', `/itsQuestionAns/summaryData`),params);
  }
}

export default questionnaireApi
